package ru.jexp.rcp.supply.beans.correlate;

import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;

import ru.jexp.rcp.supply.mui.JExpSupplyMessages;
import ru.jexp.rcp.supply.swtext.JExpChangeElementEvent;
import ru.jexp.rcp.supply.swtext.JExpChangeElementListener;
import ru.jexp.rcp.supply.swtext.JExpControlLookup;
import ru.jexp.rcp.supply.swtext.factory.JExpLookupFactory;
import ru.jexp.ucet.nakladnaa.Nakladnaa;

public class WizardPageNakl extends WizardPage {

	private JExpControlLookup naklLookup;

	protected WizardPageNakl() {
		super(JExpSupplyMessages.Correlate_wizard_nakl_pagename);
	}

	@Override
	public void createControl(Composite parent) {
		Composite composite = new Composite(parent, SWT.NONE);
		composite.setLayout(new FillLayout());
		naklLookup = JExpLookupFactory.createNaklLookup(composite, 200);
		naklLookup.addChangeElementListener(new JExpChangeElementListener() {
			@Override
			public void change(JExpChangeElementEvent event) {
				getWizardCorrelate().fireWizardListeners(IWizardCorrelate.WIZARD_PAGE_NAKL_CHANGENAKL);
			}
		});

		setControl(composite);
	}
	
	

	private WizardCorrelate getWizardCorrelate() {
		return (WizardCorrelate) getWizard();
	}

	public Nakladnaa getNaklLookupData() {
		return (Nakladnaa) naklLookup.getValue();
	}

}
